/**
 * Created by zhangzhihao on 2016/12/23 11:00;
 */
var vm = new Vue({
    el: '#main',
    data: {
		passMdf:{}
    },
	created:function(){

	},
  	methods:{
  		//返回上一页的点击事件的函数
  		goBtn:function(){
  			//不保留
  			history.back(-1);
  			//保留
//			history.go(-1);
  		},
		addPsw:function(){
        	if(!this.passMdf.oldPwd)
        	{
        		parent.showAlert("旧密码不能为空！");
        		return;
        	}
        	if(!this.passMdf.optPassword)
        	{
        		parent.showAlert("新密码不能为空！");
        		return;
        	}
        	if(!this.passMdf.confirmPwd)
        	{
        		parent.showAlert("确认密码不能为空！");
        		return;
        	}
        	if(this.passMdf.optPassword!=this.passMdf.confirmPwd)
        	{
        		parent.showAlert("新密码和确认密码不一致！");
        		return;
        	}
        	if(this.passMdf.oldPwd==this.passMdf.optPassword)
        	{
        		parent.showAlert("新密码和原密码不能一致！");
        		return;
        	}
        	$("#span").html("");
          	App.ajax({
                  type: "POST",
                  url: App.getApiUrl("modifyPwdURL"),
                  data:this.passMdf,
                  success:function(data){
                  	parent.showAlert("密码修改成功");
                  	parent.window.location.href=App.getBaseUrl()+"login.html";
                  }
             })
		}
  	}
});